package com.duan.controller;

import com.duan.service.UploadDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * @author db
 * @version 1.0
 * @description UploadDownloadController
 * @since 2023/8/19
 */
@RestController
public class UploadDownloadController {

    @Autowired
    private UploadDownloadService uploadDownloadService;


    @PostMapping("/uploadDocument")
    public String uploadDocument(MultipartFile file){
        uploadDownloadService.uploadDocument(file);
        return "上传成功";
    }

    @PostMapping("/download")
    public String download(HttpServletResponse response)  {
        String filePath = "D:\\RPAtest\\test.mp4";
        uploadDownloadService.download(filePath,response);
        return "下载成功";
    }
}
